package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.wap.dao.ICompositeIndexLogDao;
import com.financing.wap.dto.CompositeIndexLogDTO;
import com.financing.wap.service.ICompositeIndexLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * composite_index_log  
 * 金融指数日志 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("compositeIndexLogService")
public class CompositeIndexLogServiceImpl implements ICompositeIndexLogService{

	@Autowired
	private ICompositeIndexLogDao compositeIndexLogDao;

	@Override
	public int insert(CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(compositeIndexLog);
		DTOdateSetUtil.setUpdateInfo(compositeIndexLog);
//		compositeIndexLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return compositeIndexLogDao.insert(compositeIndexLog);
	}

	@Override
	public void update(CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(compositeIndexLog);
		compositeIndexLogDao.update(compositeIndexLog);
	}

	@Override
	public void updateForce(CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(compositeIndexLog);
		compositeIndexLogDao.updateForce(compositeIndexLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		compositeIndexLogDao.delete(id);
	}
	
	@Override
	public List<CompositeIndexLogDTO> queryList(CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		return compositeIndexLogDao.queryList(compositeIndexLog);
	}

	@Override
	public int queryListCount(CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		return compositeIndexLogDao.queryListCount(compositeIndexLog);
	}

	@Override
	public CompositeIndexLogDTO loadById(Integer id) throws SQLException {
		return compositeIndexLogDao.loadById(id);
	}
 	@Override
	public CompositeIndexLogDTO queryListGetFirst(CompositeIndexLogDTO compositeIndexLog)
			throws SQLException {
		 List<CompositeIndexLogDTO> queryList = queryList(compositeIndexLog);
		 if(queryList==null||queryList.size()==0){
			 return new CompositeIndexLogDTO();
		 }
		 return queryList.get(0);
	}

	@Override
	public List<CompositeIndexLogDTO> queryCompositeByCurtime(
			CompositeIndexLogDTO compositeIndexLog) throws SQLException {
		return compositeIndexLogDao.queryCompositeByCurtime(compositeIndexLog);
	}
}
